home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MACD 5
/
MACD 5.bin
/
workbench
/
blankery
/
bserverdir
/
sources
/
clients
/
fadescreen.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-11-25
|
4KB
|
190 lines
; /*
sc fadescreen.c DATA=FAR NMINC STRMERGE NOSTKCHK IGNORE=73 STRUCTUREEQUIVALENCE NOSTDIO
slink from lib:c.o fadescreen.o to //Clients/FadeScreen lib /lib/client.lib lib:sc.lib lib:amiga.lib SC SD STRIPDEBUG NOICONS
delete fadescreen.o
quit
FadeScreen 1.2 (Client for BServer)
Copyright © 1994 Stefano Reksten of 3AM - The Three Amigos!!!
All rights reserved.
*/
#include <exec/memory.h>
#include <intuition/intuition.h>
#include <intuition/intuitionbase.h>
#include <graphics/gfxbase.h>
#include <clib/exec_protos.h>
#include <clib/graphics_protos.h>
#include "/include/client.h"
struct IntuitionBase *IntuitionBase;
struct GfxBase *GfxBase;
struct Library *BitMapBase;
struct Screen *scr;
UWORD scrdepth;
struct DisplayIDInformation *dinfo;
ULONG command;
BOOL CheckAA( void )
{
if ( GfxBase->ChipRevBits0 & 1<<GFXB_AA_ALICE )
return ( TRUE );
else
return( FALSE );
}
void FadeOut( void )
{
UWORD n;
ULONG color;
BOOL still_fading, blanking;
ULONG *current, *colors, *faded, colorsize = (257 * 3 + 1) * sizeof(ULONG);
ULONG r, g, b;
BOOL result = FALSE;
scr = IntuitionBase->FirstScreen;
scrdepth = scr->RastPort.BitMap->Depth;
if ( colors = AllocVec( colorsize, MEMF_ANY|MEMF_CLEAR ) )
{
if ( faded = AllocVec( colorsize, MEMF_ANY|MEMF_CLEAR ) )
{
if ( CheckAA() )
{
current = colors;
current++;
GetRGB32( scr->ViewPort.ColorMap, 0, 1<<scrdepth, current );
*colors = (1L<<scrdepth)<<16;
CopyMem( colors, faded, colorsize );
}
else
{
current = colors;
current++;
for ( n = 0; n < 1<<scrdepth; n++ )
{
color = GetRGB4( scr->ViewPort.ColorMap, n );
*current++ = color >> 8;
*current++ = (color & 0xF0) >> 4;
*current++ = color & 0xF;
CopyMem( colors, faded, colorsize );
}
}
result = TRUE;
SpritesOff();
blanking = TRUE;
still_fading = TRUE;
while( blanking )
{
if ( still_fading )
command = GetServerCommand();
else
command = WaitServerCommand();
if ( command == COMMAND_QUIT )
blanking = FALSE;
else
if ( still_fading )
{
current = faded;
current++;
still_fading = FALSE;
if ( CheckAA() )
{
for ( n = 0; n < 1<<scrdepth; n++ )
{
if ( *current >> 24 )
*current -= 0x01000000;
r = *current++;
if ( *current >> 24 )
*current -= 0x01000000;
g = *current++;
if ( *current >> 24 )
*current -= 0x01000000;
b = *current++;
if ( (r|g|b) >> 24 )
still_fading = TRUE;
}
WaitTOF();
LoadRGB32( &scr->ViewPort, faded );
}
else
{
WaitTOF();
for ( n = 0; n < 1<<scrdepth; n++ )
{
if ( *current )
*current -= 0x01;
r = *current++;
if ( *current )
*current -= 0x01;
g = *current++;
if ( *current )
*current -= 0x01;
b = *current++;
if ( r|g|b )
still_fading = TRUE;
SetRGB4( &scr->ViewPort, n, r, g, b );
}
}
}
}
SpritesOn();
current = colors;
current++;
if ( CheckAA() )
LoadRGB32( &scr->ViewPort, colors );
else
for ( n = 0; n < 1<<scrdepth; n++ )
{
r = *current++;
g = *current++;
b = *current++;
SetRGB4( &scr->ViewPort, n, r, g, b );
}
FreeVec( faded );
}
FreeVec( colors );
}
if ( !result )
SendClientMsg( ACTION_FAILED );
}
void __main( char *line )
{
if ( IntuitionBase = (struct IntuitionBase *)OpenLibrary( "intuition.library", 36L ) )
{
if ( GfxBase = (struct GfxBase *)OpenLibrary( "graphics.library",0L ) )
{
if ( dinfo = OpenCommunication() )
{
FadeOut();
CloseCommunication( dinfo );
}
CloseLibrary( (struct Library *)GfxBase );
}
CloseLibrary( (struct Library *)IntuitionBase );
}
}